Macromedia Flex Article

Extending Design Patterns into RIA


Table of Contents

  1. Introduction
  2. Rich Internet Application Design
  3. Patterns in a Rich Internet Application Architecture
  4. Client Component to Server Communication
  5. There Is Always More

Rich Internet Application Design

Enterprise applications today are typically designed in a tiered fashion, where you organize application logic based on its purpose. The following diagram is typical of most n-tier applications:

A typical n-tier application

Figure 1. A typical n-tier application

There are three major tiers: the client, the middle, and the enterprise information system (EIS) tier. Each major tier contains logic specific to the tier’s purpose. For example:

  • The client tier contains the user interface and containers for the application interface
  • The presentation tier contains logic to render content and handle user sessions and state management
  • The business tier contains the business logic for the system
  • The integration tier contains the connectors and adaptors that access remote processes and data sources
  • The resource tier contains data from databases, enterprise information sources like ERP systems, and XML files

In a typical web deployed system, like in J2EE applications, the structure is as follows:

A typical web deployed system

Figure 2. A typical web deployed system

In web deployed systems, the logic that determines application flow, content creation, and content delivery resides on the middle tier because the primary characteristic of the traditional web application is a request/response model with the browser as the client. To deliver an application interface, the system needs to completely format and render content in the form of HTML before it moves it off the middle tier and delivers it to the client. Modifying any part of the presentation requires a request to the server; the response includes an entire page, not just the modified portion. While applets and JavaScript/DHTML solutions offer an alternative to client tiers in a traditional web model, they have never become mainstream due to a variety of technical reasons, primarily around browser inconsistencies.

Moving to a rich client model allows you to reorganize the way you render a view to better reflect the structure of the application. See the following diagram:

A rich client model

Figure 3. A rich client model

Unlike J2EE applications, where the client request causes the system to construct a page and send it to the client, a Rich Internet Application leverages a much smaller unit, a component. Components range in size from the smallest poll question to a complete view or page. The RIA model breaks the interface into multiple touch points with which a user interacts and allows each point to communicate to the server directly.

This shift in application design from a page to a component focus allows the client tier to evolve and become smarter. Smarter clients no longer represent an end point to a server request but augment application capabilities, such as allowing application interaction without a server connection such as you would find in the requirements for occasionally connected applications.

The last characteristic to note in the emerging rich Internet model is the event model. Unlike the traditional model where the server receives the request and then creates the interface in top-down fashion, you can’t necessarily predict the sequence of events. Since each component is independent, it is not tied to a request that sends one response for the whole view. The ability for each component to send messages to the server requires that each component know how to handle responses from the server. In RIAs, asynchronous messaging enables you to control how the component creates messages to the server and the messages that respond to calls. With these workflow-driven application flows, you can decouple and separate application functionality for more granular control and leverage emerging service-oriented architectures.